package whf.framework.meta.service;

import org.jdom.Document;

import whf.framework.exception.AppException;
import whf.framework.exception.CreateException;
import whf.framework.exception.DAOException;
import whf.framework.exception.UpdateException;
import whf.framework.meta.entity.View;
import whf.framework.meta.entity.ViewProperty;

/**
 * @author wanghaifeng
 * @email king@126.com
 * @modify 2006-05-31
 */
public interface ViewService extends whf.framework.service.Service<View> {

	/**
	 * @modify wanghaifeng Oct 29, 2006 8:29:35 AM
	 * @param view
	 * @param property
	 * @throws CreateException
	 * @throws UpdateException
	 */
	public void addProperty(View view, ViewProperty property) throws CreateException, UpdateException;
	
	/**
	 * 通过元数据对象创建视图
	 * @modify wanghaifeng Sep 27, 2006 10:17:33 PM
	 * @param object
	 * @return
	 * @throws CreateException
	 */
	public View createByObject(whf.framework.meta.entity.Object object) throws CreateException;
	
	/**
	 * according to the viewCode, create or update a view
	 * @param doc	jdom document
	 * xml format:<br>
	 * <pre>
	 * <views>
	 * 	<view code="">
	 * 		<property id="" name="" />
	 * 	</view>
	 * </views>
	 * </pre>
	 * @throws DAOException
	 */
	public void importFromXml(Document doc) throws DAOException;
	
	/**
	 * @param doc
	 * @return
	 * @throws AppException
	 */
	public Document exportToXml(Document doc) throws AppException;
} 